<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<meta name="generator" content="JsDoc Toolkit" />
		
		<title>JsDoc Reference - Function</title>
		<link href="../css/default.css" type="text/css" rel="stylesheet" media="all" />
	</head>

	<body>
		<div id="header">
</div>

		<div class="index">
			<div class="menu">
				<!-- begin publish.classesIndex -->
				<div align="center"><a href="../index.html">Class Index</a> | <a href="../files.html">File Index</a></div>

<h2 class="heading1">Classes</h2>

<ul class="classList">
	
		<li><a href="../symbols/_global_.html">_global_</a></li>
	
		<li><a href="../symbols/Function.html">Function</a></li>
	
</ul>

				<!-- end publish.classesIndex -->
			</div>
			
			<div class="fineprint" style="clear:both">
				&copy;2010<br />
				Generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on Mon Sep 06 2010 16:35:33 GMT+0100 (IST)<br />
				HTML template: <a href="http://www.thebrightlines.com/2010/05/06/new-template-for-jsdoctoolkit-codeview/" target="_blank">Codeview</a>
			</div>
		</div>
		
		<div class="content">
			<div class="innerContent">
				<h1 class="classTitle">
					
					Built-In Namespace <span>Function</span>
				</h1>

				<p class="description summary">
					
					
					
				
					
					
					
				</p>

				

				

	<!--
	#### METHODS SUMMARY
	-->
				
					
					
						<div class="props">
							<table class="summaryTable" cellspacing="0" summary="A summary of the methods documented in the class Function.">
								<caption>Method Summary</caption>
								
								<thead>
									<tr>
										<th scope="col">Method Attributes</th>
										<th scope="col">Method Name and Description</th>
									</tr>
								</thead>
								
								<tbody>
									
										<tr>
											<td class="attributes">&lt;static&gt; &nbsp;</td>
											<td class="nameDescription">
												<div class="fixedFont">Function.<b><a href="../symbols/Function.html#.bind">bind</a></b>(executionScope, presetArgs)
												</div>
												<div class="description">Set a functions execution scope and optionally preset the
arguments that will be supplied to it on execution.</div>
											</td>
										</tr>
									
										<tr>
											<td class="attributes">&lt;static&gt; &nbsp;</td>
											<td class="nameDescription">
												<div class="fixedFont">Function.<b><a href="../symbols/Function.html#.getName">getName</a></b>()
												</div>
												<div class="description">Determine a functions name.</div>
											</td>
										</tr>
									
										<tr>
											<td class="attributes">&lt;static&gt; &nbsp;</td>
											<td class="nameDescription">
												<div class="fixedFont">Function.<b><a href="../symbols/Function.html#.implement">implement</a></b>(arguments)
												</div>
												<div class="description">Implement any number of traits on a constructors prototype.</div>
											</td>
										</tr>
									
										<tr>
											<td class="attributes">&lt;static&gt; &nbsp;</td>
											<td class="nameDescription">
												<div class="fixedFont">Function.<b><a href="../symbols/Function.html#.implementStatic">implementStatic</a></b>(arguments)
												</div>
												<div class="description">Implement any number of traits on a constructor.</div>
											</td>
										</tr>
									
										<tr>
											<td class="attributes">&lt;static&gt; &nbsp;</td>
											<td class="nameDescription">
												<div class="fixedFont">Function.<b><a href="../symbols/Function.html#.inherit">inherit</a></b>(Parent)
												</div>
												<div class="description">Extend one constructors prototype by anothers.</div>
											</td>
										</tr>
									
										<tr>
											<td class="attributes">&lt;static&gt; &nbsp;</td>
											<td class="nameDescription">
												<div class="fixedFont">Function.<b><a href="../symbols/Function.html#.is">is</a></b>(value)
												</div>
												<div class="description">Determine if a value is an instance of a type, eliding the 
distinction between primitives and their object counterparts.</div>
											</td>
										</tr>
									
								</tbody>
							</table>
						</div>
					
					
					
				
				
	<!--
	#### EVENTS SUMMARY
	-->
				

	<!--
	#### CONSTRUCTOR DETAILS
	-->
				

	<!--
	#### FIELD DETAILS
	-->
				

	<!--
	#### METHOD DETAILS
	-->		
				
					<div class="details props">
						<div class="innerProps">
							<div class="sectionTitle">
								Method Detail
							</div>
							
							
								<a name=".bind"></a>
								
								<div class="fixedFont heading">
									<span class='lighter'>
									&lt;static&gt; 
									</span>
									
									<span class="light">{<a href="../symbols/Function.html">Function</a>}</span>
									
									<span class="light">Function.</span><b>bind</b>(executionScope, presetArgs)
								</div>
								
								<div class="description">
									Set a functions execution scope and optionally preset the
arguments that will be supplied to it on execution.
									
									
										<br />
										<i>Defined in: </i> <a href="../symbols/src/_Volumes_Workspace_Aptana_ObjectKit_Asset_Library_ie_ondevice_objectkit_core.js.html">core.js</a>.
									
									
									
								</div>
								
								
								
								
									<dl class="detailList params">
										<dt class="heading">Parameters:</dt>
										
											<dt>
												<span class="light fixedFont">{Object}</span> <b>executionScope</b>
												
											</dt>
											<dd>The functions execution scope</dd>
										
											<dt>
												<span class="light fixedFont">{Object...}</span> <b>presetArgs</b>
												
											</dt>
											<dd>The arguments the function will use</dd>
										
									</dl>
								
								
								
									<dl class="detailList nomargin">
									
										
										
										
										
										
										
										
											<dt class="heading">Returns:</dt>
											
												<dd><span class="light fixedFont">{<a href="../symbols/Function.html">Function</a>}</span> A curried function</dd>
											
										
										
										
										
										
									
									</dl>
								

								<div class="hr"></div>
							
								<a name=".getName"></a>
								
								<div class="fixedFont heading">
									<span class='lighter'>
									&lt;static&gt; 
									</span>
									
									<span class="light">{String}</span>
									
									<span class="light">Function.</span><b>getName</b>()
								</div>
								
								<div class="description">
									Determine a functions name. If a function is anonymous, or otherwise
does not have a name, the return value will be 'anonymous'.
									
									
										<br />
										<i>Defined in: </i> <a href="../symbols/src/_Volumes_Workspace_Aptana_ObjectKit_Asset_Library_ie_ondevice_objectkit_core.js.html">core.js</a>.
									
									
									
								</div>
								
								
								
								
								
								
									<dl class="detailList nomargin">
									
										
										
										
										
										
										
										
											<dt class="heading">Returns:</dt>
											
												<dd><span class="light fixedFont">{String}</span> The name of a function.</dd>
											
										
										
										
										
										
									
									</dl>
								

								<div class="hr"></div>
							
								<a name=".implement"></a>
								
								<div class="fixedFont heading">
									<span class='lighter'>
									&lt;static&gt; 
									</span>
									
									<span class="light">{<a href="../symbols/Function.html">Function</a>}</span>
									
									<span class="light">Function.</span><b>implement</b>(arguments)
								</div>
								
								<div class="description">
									Implement any number of traits on a constructors prototype. Traits
are added subject to the same rules enforced by #implementStatic.
description continued here
									
									
										<br />
										<i>Defined in: </i> <a href="../symbols/src/_Volumes_Workspace_Aptana_ObjectKit_Asset_Library_ie_ondevice_objectkit_core.js.html">core.js</a>.
									
									
									
								</div>
								
								
									
										<pre class="code"><code><pre>
// 1. Using named functions
CustomObject.implement
(
    function method () 
    {
        // implementation
    }
);

function CustomObject ()
{
    this.method();
};
</pre></code></pre>
									
										<pre class="code"><code>
<pre>
//2. Using an object literal
CustomObject.implement
(
    {
        property: null
        
    ,   method: function () 
        {
            // implementation
        }
    }
);

</pre>
</code>
The method also lends itself to trait borrowing quite well.</pre>
									
										<pre class="code"><code><pre>
AnotherCustomObject.implement(CustomObject.prototype);
function AnotherCustomObject ()
{
    this.method();
};
</pre></code>

<p>And defining dynamic class instances</p></pre>
									
										<pre class="code"><code><pre>
var mixin= new function (value)
{
    var hiddenValue= value;
    this.constructor.implement
    (
        function getHiddenValue () 
        {
            return hiddenValue
        }
    );
}('someValue');
</pre></code></pre>
									
								
								
								
									<dl class="detailList params">
										<dt class="heading">Parameters:</dt>
										
											<dt>
												<span class="light fixedFont">{Object...}</span> <b>arguments</b>
												
											</dt>
											<dd></dd>
										
									</dl>
								
								
								
									<dl class="detailList nomargin">
									
										
										
										
										
										
										
										
											<dt class="heading">Returns:</dt>
											
												<dd><span class="light fixedFont">{<a href="../symbols/Function.html">Function</a>}</span> The constructor</dd>
											
										
										
										
										
										
											<dt class="heading">See:</dt>
											
												<dd><a href="#implementStatic">#implementStatic</a></dd>
											
										
									
									</dl>
								

								<div class="hr"></div>
							
								<a name=".implementStatic"></a>
								
								<div class="fixedFont heading">
									<span class='lighter'>
									&lt;static&gt; 
									</span>
									
									<span class="light">{<a href="../symbols/Function.html">Function</a>}</span>
									
									<span class="light">Function.</span><b>implementStatic</b>(arguments)
								</div>
								
								<div class="description">
									Implement any number of traits on a constructor.
									
									
										<br />
										<i>Defined in: </i> <a href="../symbols/src/_Volumes_Workspace_Aptana_ObjectKit_Asset_Library_ie_ondevice_objectkit_core.js.html">core.js</a>.
									
									
									
								</div>
								
								
								
								
									<dl class="detailList params">
										<dt class="heading">Parameters:</dt>
										
											<dt>
												<span class="light fixedFont">{Object...}</span> <b>arguments</b>
												
											</dt>
											<dd></dd>
										
									</dl>
								
								
								
									<dl class="detailList nomargin">
									
										
										
										
										
										
										
										
											<dt class="heading">Returns:</dt>
											
												<dd><span class="light fixedFont">{<a href="../symbols/Function.html">Function</a>}</span> </dd>
											
										
										
										
										
										
											<dt class="heading">See:</dt>
											
												<dd><a href="#implement">#implement</a></dd>
											
										
									
									</dl>
								

								<div class="hr"></div>
							
								<a name=".inherit"></a>
								
								<div class="fixedFont heading">
									<span class='lighter'>
									&lt;static&gt; 
									</span>
									
									<span class="light">{<a href="../symbols/Function.html">Function</a>}</span>
									
									<span class="light">Function.</span><b>inherit</b>(Parent)
								</div>
								
								<div class="description">
									Extend one constructors prototype by anothers.
									
									
										<br />
										<i>Defined in: </i> <a href="../symbols/src/_Volumes_Workspace_Aptana_ObjectKit_Asset_Library_ie_ondevice_objectkit_core.js.html">core.js</a>.
									
									
									
								</div>
								
								
									
										<pre class="code">Child.inherit(Parent);</pre>
									
										<pre class="code"><code><pre>
// a mock superclass
Parent.implement
(
    function setValue (value)
    {
        this.value= value;
    }
);

function Parent () {;};

// a mock subclass
Child.inherit(Parent).implement
(
    // override the parent method
    function setValue (value)
    {
        // introduce a guard clause
        if (false === Number.is(value))
            throw new TypeError ('Number expected');
            
        // call the superclass method like this
        this.parent.setValue.call(this, value);
    }

);

function Child () 
{
    // apply the superclass constructor logic to this instance
    Parent.call(this, 'defaultChildValue');
}
</pre></code></pre>
									
								
								
								
									<dl class="detailList params">
										<dt class="heading">Parameters:</dt>
										
											<dt>
												<span class="light fixedFont">{<a href="../symbols/Function.html">Function</a>}</span> <b>Parent</b>
												
											</dt>
											<dd>The constructor to inherit from.</dd>
										
									</dl>
								
								
								
									<dl class="detailList nomargin">
									
										
										
										
										
										
											<dt class="heading">Throws:</dt>
											
												<dt>
													<span class="light fixedFont">{TypeError}</span>  <b></b>
												</dt>
												<dd>If Parent is an invalid constructor.</dd>
											
										
										
										
											<dt class="heading">Returns:</dt>
											
												<dd><span class="light fixedFont">{<a href="../symbols/Function.html">Function</a>}</span> The extended prototypes constructor.</dd>
											
										
										
										
										
										
									
									</dl>
								

								<div class="hr"></div>
							
								<a name=".is"></a>
								
								<div class="fixedFont heading">
									<span class='lighter'>
									&lt;static&gt; 
									</span>
									
									<span class="light">{Boolean}</span>
									
									<span class="light">Function.</span><b>is</b>(value)
								</div>
								
								<div class="description">
									Determine if a value is an instance of a type, eliding the 
distinction between primitives and their object counterparts.

The method will always return false for values of null or
undefined.
									
									
										<br />
										<i>Defined in: </i> <a href="../symbols/src/_Volumes_Workspace_Aptana_ObjectKit_Asset_Library_ie_ondevice_objectkit_core.js.html">core.js</a>.
									
									
									
								</div>
								
								
								
								
									<dl class="detailList params">
										<dt class="heading">Parameters:</dt>
										
											<dt>
												<span class="light fixedFont">{Object}</span> <b>value</b>
												
											</dt>
											<dd></dd>
										
									</dl>
								
								
								
									<dl class="detailList nomargin">
									
										
										
										
										
										
										
										
											<dt class="heading">Returns:</dt>
											
												<dd><span class="light fixedFont">{Boolean}</span> </dd>
											
										
										
										
										
										
									
									</dl>
								

								
							
						</div>
					</div>
				
				
	<!--
	#### EVENT DETAILS
	-->		
				
			</div>
		</div>
	</body>
</html>
